home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programmer's Power Pack
/
Delphi Volume 1.iso
/
e_to_l
/
fbuilder
/
delphi
/
fbdbcomp.int
< prev
next >
Wrap
Text File
|
1996-09-15
|
6KB
|
195 lines
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
{ FORMULABUILDER }
{ YGB Software, Inc }
{ Copyright 1995 Clayton Collie }
{ All Rights Reserved }
{ DBFiltuz.pas and TUZFilter are Copyright INFOPLAN }
{ All Rights Reserved }
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
UNIT FBDBComp;
{
// This unit defines evaluator classes to handle expressions based on
// BDE Databases
}
INTERFACE
uses Classes,Sysutils,DBITypes,DB,DBTables,DBFiltUz,Forms,
Fbcalc,FBComp;
CONST
FIELDDESIGNATOR = '->';
{ ERRORS }
EXPR_INVALID_DATABASE = 100;
EXPR_INVALID_TABLENAME = 111;
EXPR_INVALID_FIELDNAME = 113;
EXPR_INVALID_DATASET = 115;
EXPR_INVALID_TABLE = 115;
EXPR_INVALID_FIELD = 117;
TYPE
EFBDBError = Class(EFBError)
Constructor CreateECode(const ecode : integer);
end;
{ TDataset Expression Class }
{ Custom Dataset Expression. Forms the basis of the TDSExpression }
{ and TDSFilterExpression classes }
TCustomDSExpression = Class(TCustomExpression)
Private
fDataset : TDataset;
Procedure Setdataset(const theDb : Tdataset);
Protected
Property Dataset : TDataset read fdataset write setdataset;
Public
Constructor Create(AOwner : TComponent); override;
Function StatusText : string; override;
Published
Property Formula;
Property Lines;
Property UseExceptions;
end;
TDSFilterExpression = Class(TCustomDSExpression)
Private
fAcceptIfNull : boolean;
Function doAccept : boolean;
protected
{make sure only boolean expressions are entered }
Procedure SetExpression(const expr : pchar); override;
Public
Property Accept : boolean read doAccept;
Published
Property Dataset;
Property AcceptIfNull : boolean read fAcceptIfNull
write fAcceptIfNull
default true;
end;
{
//
// TDSFilter - Datasource Filter based on Uli Zindler's DBFilt16
//
}
TDSFilter = Class(TCustomDSExpression)
Private
fDatasource : TDataSource;
fActive : boolean;
Procedure SetDataSource(const aDatasource : TDatasource );
Procedure SetActive( value : boolean );
Procedure SetPriority( value : word );
Function GetPriority : word;
Function getAutoRefresh : boolean;
Procedure SetAutoRefresh(value : boolean);
Function GetLoadActive : boolean;
Procedure SetloadActive(value : boolean);
Function GetHandle : hDBIFilter;
Protected
{make sure only boolean expressions are entered }
Procedure SetExpression(const expr : pchar); override;
Public
Constructor Create(AOwner : TComponent); override;
Destructor Destroy; override;
Property FilterHandle : hDBIFilter read getHandle;
Procedure Refresh;
Published
Property Active : boolean read fActive write SetActive;
Property AutoRefresh : boolean read getAutoRefresh
write SetAutoRefresh
default true;
Property Datasource : TDatasource read fDatasource write SetDatasource;
Property LoadActivated : boolean read getLoadActive write setLoadActive;
Property Priority : Word read getPriority write setPriority;
end;
TDSExpression = Class(TCustomDSExpression)
Public
Property AsBoolean;
Property AsDate;
Property AsFloat;
Property AsInteger;
Property AsString;
Property FunctionCount;
Property ReturnType;
Published
Property Dataset;
end;
{*
*
* The Database Expression Classes
*
*}
TCustomDBExpression = Class(TCustomExpression)
Private
fDatabase : TDatabase;
Procedure SetDatabase(const theDb : TDatabase);
Public
Constructor Create(AOwner : TComponent); override;
Function StatusText : string; override;
published
Property Formula;
Property Lines;
Property UseExceptions;
Property Database : TDatabase read fDatabase write setDatabase;
end;
TDBExpression = Class(TCustomDBExpression)
Public
Property AsBoolean;
Property AsDate;
Property AsFloat;
Property AsString;
Property AsInteger;
Property FunctionCount;
Property ReturnType;
published
Property Database;
end;
{
//
// Declares a Database Filter class
//
}
TDBFilterExpression = Class(TCustomDBExpression)
Private
fAcceptIfNull : boolean;
Function doAccept : boolean;
protected
{make sure only boolean expressions are entered }
Procedure SetExpression(const expr : pchar); override;
Public
Property AcceptIfNull : boolean read fAcceptIfNull
write fAcceptIfNull
default true;
Property Accept : boolean read doAccept;
end;
Function FieldDataType(const f : TField):datatypes;
function getErrorString(const ecode : integer):string;
function IsValidDBExpression(thedb : TDatabase;expr : pchar):Boolean;
Procedure RaiseError(const ecode : integer);
Procedure Register;
IMPLEMENTATION
END.